<?php

namespace App\Module\Api\Controllers;
use App\Module\Api\Controllers\Request\CurrencyConversionRequest;
use App\Module\Api\Validator\CurrencyConversionValidator;
use App\System\Base\Services\TokenService;
use App\System\Cis\Repositories\CisUserRepository;

/**
 * 积分转注册币
 */
class CurrencyConversionController extends Controller
{
    public function __construct()
    {
        $this->query = new CurrencyConversionRequest();
        parent::__construct();
    }

    public function index()
    {
        (new CurrencyConversionValidator())->check();
        $user_id = TokenService::getUserId();
        $user = CisUserRepository::getInstance();
        $res = $user->conversion($this->query,$user_id);
        return apiResponse($res);
    }
}
